package spring.factoryBean;

import com.me.common.pojo.Student;
import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.lang3.RandomUtils;
import org.springframework.beans.factory.FactoryBean;

/**
 * FactoryBean 测试：自定义 FactoryBean
 *
 * @author ME
 * @date 2021/4/8
 */
public class StudentFactoryBean implements FactoryBean<Student> {

    @Override
    public Student getObject() throws Exception {
        return new Student(RandomStringUtils.random(3, true, false),
                RandomUtils.nextInt(20, 30));
    }

    @Override
    public Class<?> getObjectType() {
        return Student.class;
    }

}
